{{ if and .Site.Params.enableRelatedPosts (.Params.related | default .Site.Params.displayRelatedPosts) }}
    {{ $related := .Site.RegularPages.Related . | first (.Site.Params.relatedPostsNumber | default 5) }}
    {{ with $related }}
        <div class="related-posts">
            <h2 class="related-title">{{ i18n "relatedPosts" }}{{ partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.relatedPostsIcon "class" "related-icon") }}</h2>
            <ul class="related-list">
                {{ range . }}
                    <li class="related-item">
                        <a href="{{ .RelPermalink }}" class="related-link">{{ (partial "utils/title.html" (dict "$" . "title" .LinkTitle)).htmlTitle }}</a>
                    </li>
                {{ end }}
            </ul>
        </div>
    {{ end }}
{{ end }}
